package com.lee.java8.stream;


import org.junit.Test;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;

public class Test1 {


    /**
     * 读取文件修改
     *
     * @throws IOException
     */
    @Test
    public void test1() throws IOException {
        String content = new String(Files.readAllBytes(Paths.get("lixin.properties")), StandardCharsets.UTF_8);
        String[] words = content.split("\n");
        long count = Arrays.stream(words).filter((w) -> w.length() > 15).count();
        System.out.println(count);
    }

    @Test
    public void test2() throws IOException {
        long count = Files.lines(Paths.get("lixin.properties")).count();
        System.out.println(count);
    }

    @Test
    public void test3() {
//        String[] a = new Array[]{"1","2"};
//        final StringJoiner m = new StringJoiner("m", a);
//        m.add("1");
//        System.out.println(m.toString());
    }

}



